package com.atguigu.java.proxy;

import sun.applet.Main;

/**
 * 静态代理
 * Created by Chauncey on 2019/6/19.
 */
interface ClothFactory {
    void productCloth();

}
class ProxyClothFactory implements ClothFactory{
    private ClothFactory clothFactory;
    @Override
    public void productCloth() {
        System.out.println("代理工厂的准备工作");
        clothFactory.productCloth();
        System.out.println("代理工厂的收尾工作");
    }

    public ProxyClothFactory(ClothFactory clothFactory) {
        this.clothFactory = clothFactory;
    }
}

class NikeClothFactory implements ClothFactory{
    @Override
    public void productCloth() {
        System.out.println("nike厂生产了一批衣服");
    }
}
public class StaticProxyTest {
    public static void main(String[] args) {
        ClothFactory nike = new NikeClothFactory();
        ClothFactory proxy = new ProxyClothFactory(nike);
        proxy.productCloth();
    }
}
